Last updated on 2025-Feb-19 at 11:18 AM.
Data collected by Research Assistant Reann Post and Research Coordinator Lynn Murphy.
# load packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(here)
## here() starts at /Users/eadie/EadieTech/retinalogik-study
library(DT)
library(plotly)
##
## Attaching package: 'plotly'
##
## The following object is masked from 'package:ggplot2':
##
## last_plot
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following object is masked from 'package:graphics':
##
## layout
library(viridis)
## Loading required package: viridisLite
library(svglite)
library(htmltools)
library(gridExtra)
##
## Attaching package: 'gridExtra'
##
## The following object is masked from 'package:dplyr':
##
## combine
sessionInfo()
## R version 4.4.2 (2024-10-31)
## Platform: aarch64-apple-darwin20
## Running under: macOS Ventura 13.7.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/Halifax
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] gridExtra_2.3 htmltools_0.5.8.1 svglite_2.1.3 viridis_0.6.5
## [5] viridisLite_0.4.2 plotly_4.10.4 DT_0.33 here_1.0.1
## [9] lubridate_1.9.4 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
## [13] purrr_1.0.4 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
## [17] ggplot2_3.5.1 tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.9 generics_0.1.3 stringi_1.8.4 hms_1.1.3
## [5] digest_0.6.37 magrittr_2.0.3 evaluate_1.0.3 grid_4.4.2
## [9] timechange_0.3.0 fastmap_1.2.0 rprojroot_2.0.4 jsonlite_1.8.9
## [13] httr_1.4.7 scales_1.3.0 lazyeval_0.2.2 jquerylib_0.1.4
## [17] cli_3.6.3 rlang_1.1.5 munsell_0.5.1 withr_3.0.2
## [21] cachem_1.1.0 yaml_2.3.10 tools_4.4.2 tzdb_0.4.0
## [25] colorspace_2.1-1 vctrs_0.6.5 R6_2.6.0 lifecycle_1.0.4
## [29] htmlwidgets_1.6.4 pkgconfig_2.0.3 pillar_1.10.1 bslib_0.9.0
## [33] gtable_0.3.6 glue_1.8.0 data.table_1.16.4 systemfonts_1.2.1
## [37] xfun_0.50 tidyselect_1.2.1 rstudioapi_0.17.1 knitr_1.49
## [41] rmarkdown_2.29 compiler_4.4.2
# default chunk options
knitr::opts_chunk$set(
comment = '>', cache = TRUE, collapse = TRUE, cache = FALSE, dev= c("png")
)
# load processed data
load(here("dBdat.Rda"))
We compared 24-2 Full Threshold visual field (VF) test results between Retinalogik and Humphrey Field Analyzer (HFA) in patients with early glaucoma and moderate to advanced glaucoma.
Eligible participants were identified among patients of Dr. Brennan Eadie at the Eadie Eye Centre. If deemed eligible for the study, subjects were recruited consecutively.
Each participant underwent five study visits. At each visit, they performed a VF test on both eyes using two devices. The order of device tested was randomized at the first (baseline) study visit.
The study adhered to the tenets of the Declaration of Helsinki for research involving human subjects and the protocol was approved by the Nova Scotia Health Research Ethics Board (#1030608). All participants gave their written informed consent before enrollment in the study.
All OS data will be transposed to OD format before analyses. Data from 11 participants (8 females, 2 males) aged 44 to 76 (M = 65.14, SD = 8.68) were included in the analysis.
library(ggplot2)
library(slickR)
# make sure coordinates are numeric, then flip OS to OD for plotting purposes
dBdat %<>%
mutate(x = as.numeric(x), y = as.numeric(y)) %>%
mutate(x = case_when(
eye == "L" & device == "hfa" ~ x*-1,
TRUE ~ as.numeric(x)))
dBdat %>%
mutate(dB = as.numeric(dB)) %>%
filter(device == "hfa") %>%
group_by(id, visit, eye) %>%
arrange(id, visit, eye) %>%
# Use the group_by %>% nest pattern to group data by id
nest() %>%
# Use map2 so the id can be used as the title
mutate(graphs = map2(data, id,
~ggplot(data = .x, aes(x, y, dB)) +
geom_raster(aes(x = x, y = y, fill = dB)) +
geom_text(aes(label = dB, x = x, y = y), size = 8) +
coord_fixed(ratio = 1) +
scale_fill_gradientn(colours = viridis(47), limits = c(-1, 46),
na.value="darkred") +
theme_bw() +
ggtitle(paste0("HFA ", id, " Visit ", visit, " Eye: ", eye))
)
) %>%
# pull is the pipe-able equivalent of .[['graphs']]
pull(graphs) %>%
# Return the svg of graphs
map(function(gr) svglite::xmlSVG(show(gr), standalone = TRUE)) ->
hfa_individual_graphs
dBdat %>%
mutate(dB = as.numeric(dB)) %>%
filter(device == "retinalogik") %>%
group_by(id, visit, eye) %>%
arrange(id, visit, eye) %>%
# Use the group_by %>% nest pattern to group data by id
nest() %>%
# Use map2 so the id can be used as the title
mutate(graphs = map2(data, id,
~ggplot(data = .x, aes(x, y, dB)) +
geom_raster(aes(x = x, y = y, fill = dB)) +
geom_text(aes(label = dB, x = x, y = y), size = 8) +
coord_fixed(ratio = 1) +
scale_fill_gradientn(colours = viridis(47), limits = c(-1, 46),
na.value="darkred") +
theme_bw() +
ggtitle(paste0("Retinalogik ", id, " Visit ", visit, " Eye: ", eye))
)
) %>%
# pull is the pipe-able equivalent of .[['graphs']]
pull(graphs) %>%
# Return the svg of graphs
map(function(gr) svglite::xmlSVG(show(gr), standalone = TRUE)) ->
rt_individual_graphs
# carousels
hfa_plots <- slickR(hfa_individual_graphs, height = 350, width = "95%", padding = 0) +
settings(slidesToShow = 2, slidesToScroll = 2)
rt_plots <- slickR(rt_individual_graphs, height = 350, width = "95%", padding = 0) +
settings(slidesToShow = 2, slidesToScroll = 2)
rt_plots %synch% hfa_plots
Instrument output mean deviation and pattern standard deviation measurements were strongly correlated between devices. The intraclass correlation co-efficient was similar to the Pearson r for mean deviation (0.87 vs. 0.86) but was lower than the Pearson r for pattern standard deviation (0.94 vs. 0.82).
library(BlandAltmanLeh)
mdpsd <- dBdat %>%
distinct(id, age, visit, device, eye, md, psd) %>%
pivot_wider(names_from = device,
values_from = c(md, psd))
p <- bland.altman.plot(mdpsd$md_hfa, mdpsd$md_retinalogik, graph.sys = "ggplot2")
p1 <- print(p + geom_smooth(method = "lm", se = FALSE) + xlab("Mean deviation (MD)") + ylab("Difference in mean deviation (dB)") + ggtitle("Bland-Altman plots (HFA-Retinalogik)"))
> `geom_smooth()` using formula = 'y ~ x'
p <- bland.altman.plot(mdpsd$psd_hfa, mdpsd$psd_retinalogik, graph.sys = "ggplot2")
p2 <- print(p + geom_smooth(method = "lm", se = FALSE) + xlab("Pattern standard deviation (PSD)") + ylab("Difference in pattern standard deviation (dB)"))
> `geom_smooth()` using formula = 'y ~ x'
# grid.arrange(p1, p2, ncol=2, top = "Bland-Altman plots")
dBdat %>%
distinct(id, age, visit, device, eye, md, psd) %>%
datatable(extensions = 'Buttons', options = list(
dom = 'Bfrtip',
buttons =
list('copy', 'print', list(
extend = 'collection',
buttons = c('csv', 'excel', 'pdf'),
text = 'Download'
))
))
# library(psych)
#
# hfa <- dBdat %>%
# # filter(id == "RL01" ) %>%
# filter(device=="hfa") %>%
# distinct(id, visit, md)
#
# retinalogik <- dBdat %>%
# filter(id != "RL04") %>%
# filter(device=="retinalogik") %>%
# distinct(id, visit, md)
#
# tmp <- dBdat %>%
# # filter(id == "RL01" ) %>%
# # filter(device=="hfa") %>%
# distinct(id, visit, device, eye, md) %>%
# arrange(id, visit, eye)
#
# md <- tibble(hfa=hfa$md, rl=retinalogik$md)
#
# ICC(md,missing=TRUE,alpha=.05,lmer=TRUE,check.keys=FALSE)
For those interested in the cleaned up pointwise data.
dBdat %>%
select(id, age, device, eye, x, y, dB) %>%
datatable(options = list(
order = list(1, 'asc')
))
Report by Vivian Eng